class Player {
	constructor(name, sid, ip) {
		this.name = name;
		this.sid = sid;
		this.ip = ip;
		this.isHuman = true;
		this.state = 1;
		this.roomIndex = -1;
		this.deskIndex = -1
	}
	// 玩家进入某一桌游戏中
	joinRoom(room) {
		if (room.isEmpty()) {
			this.roomIndex = room.roomIndex;
			this.deskIndex = room.players.length;
		}
	}
	// 某一桌游戏的玩家离开房间
	leaveRoom() {
		this.roomIndex = -1;
		this.deskIndex = -1;
	}
	// 玩家重新连接
	playerLogin() {
		this.isHuman = true;
	}
	// 玩家掉线
	playerLogout() {
		this.isHuman = false;
	}
}
module.exports = Player;